package com.zhangyj.db.util;

class OrecalUtil extends BaseDBUtil {

	
	public	String buildPagnationSql(String sql, int pageNo, int size, int tatalCount, String orderField, String orderTable, boolean isDesc) {
		int start = (pageNo - 1) * size;
		StringBuilder builder = new StringBuilder(100);
		builder.append("select * from ( select row_.*, rownum rownum_ from ( ");
		builder.append(sql);
		addOrder(builder, orderField, orderTable, isDesc);
		builder.append(" ) row_ where rownum <= " + start + ") where rownum_ > " + (start + size));
		return builder.toString();
	}
}
